package TeatCase;

import android.util.Log;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import static HomeElements.Action.*;

import HomeElements.WatcherAll;
import QunarTest.QuanrTestCase;
import util.UIHelper;

import static HomeElements.AssertElementsContent.dingZhiYouDes;
import static org.junit.Assert.*;
import static HomeElements.AssertElementsContent.*;

/**
 * Created by zhe.xiao on 2017/6/16.
 */

public class TestXiaoRuKou extends QuanrTestCase {

    @Override
    public void setUp(){
        super.setUp();
        UIHelper.getHomeElements().getXiaoRuKou().init();
    }

    /**
     * 测试签证*WiFi
     */
    @Test
    public void testWifi(){
//        clickWifi();
        UIHelper.getHomeElements().getXiaoRuKou().getElement1().click();
        Log.v("UIAUTOMATOR", "wifiDes: " + wifiDes());
        assertEquals(wifiDes(), "热门签证");
    }

    /**
     *测试出境游
     */
    @Test
    public void testChuJingYou(){
        clickChuJingYou();
        Log.v("UIAUTOMATOR", "chuJingDes: " + chuJingDes());
        assertEquals(chuJingDes(), "出境服务");
    }

    /**
     * 测试接送机
     */
    @Test
    public void testJieJiSong(){
        clickJieSongJI();
        WatcherAll.jieJiSongWatcher();
        Log.v("UIAUTOMATOR", "jieJiSongDes(): " + jieJiSongDes());
        assertEquals(jieJiSongDes(), "超级巴士");
    }

    /**
     * 测试一日游
     */
    @Test
    public void testYiRiYou(){
        clickYiRiYou();
        Log.v("UIAUTOMATOR", "yiRiYouDes: " + yiRiYouDes());
        assertEquals(yiRiYouDes(), "必游景点推荐");
    }

    /**
     * 测试智慧旅行
     */
    @Test
    public void testZhiHuiLvYou(){
        clickZhiHuiLvXing();
        Log.v("UIAUTOMATOR", "zhiHuiLvYouDes: " + zhiHuiLvYouDes());
        assertEquals(zhiHuiLvYouDes(), "智慧玩法");
    }

    /**
     * 测试定制游
     */
    @Test
    public void testDingZhiYou(){
        clickDingZhiYou();
        Log.v("UIAUTOMATOR", "dingZhiYouDes: " + dingZhiYouDes());
        assertEquals(dingZhiYouDes(), "私人定制");
    }

    /**
     * 测试特色游
     */
    @Test
    public void testTeSeZhu(){
        // TODO: 2017/6/27  这个测试总是失败 原因是找不到元素 rn页面 未找到具体原因
        clickTeSeZhu();
        String td = teSeZhuDes();
        Log.v("UIAUTOMATOR", "teSeZhuDes: " + td);

        assertEquals(td, "客栈名/地名");
    }

    /**
     * 测试领券中心
     */
    @Test
    public void testLingQuanZhongXin(){
        clickLingQunaZhongXin();
        Log.v("UIAUTOMATOR", "lingQuanZhongXinDes: " + lingQuanZhongXinDes());
        assertEquals(lingQuanZhongXinDes(), "优惠中心");
    }

    /**
     * 测试踏青赏花
     */
    @Test
    public void testTaQingShangHua(){
        clickTaQingShangHua();
        Log.v("UIAUTOMATOR", "taQingShangHuaDes: " + taQingShangHuaDes());
        assertEquals(taQingShangHuaDes(), "赏花踏青采摘");
    }

    /**
     * 测试特价游
     */
    @Test
    public void testTeJiaYou(){
        clickTeJiaYou();
        Log.v("UIAUTOMATOR", "teJiaYouDes: " + teJiaYouDes());
        assertEquals(teJiaYouDes(), "天天特价");
    }
}
